package cn.explink.dop.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.explink.dop.dao.ConditionDao;
import cn.explink.dop.dao.DistributeStrategyDao;
import cn.explink.dop.entity.vo.ConditionVO;
import cn.explink.dop.entity.vo.DistributeStrategyVO;
import cn.explink.dop.service.DistributeStrategyService;
import cn.explink.eap.core.common.service.impl.CommonServiceImpl;

@Service
public class DistributeStrategyImpl extends CommonServiceImpl implements DistributeStrategyService {

	@Autowired
	private DistributeStrategyDao distributeStrategyDao;

	@Autowired
	private ConditionDao conditionDao;

	@Override
	public List<DistributeStrategyVO> getDistributeStrategyList(DistributeStrategyVO distributeStrategyVO) {
		return this.distributeStrategyDao.getDistributeStrategyList(distributeStrategyVO);
	}

	@Override
	public Map<String, Object> getListDataByPage(DistributeStrategyVO distributeStrategyVO, int pageNum, int pageSize) {
		return this.distributeStrategyDao.findByPage(distributeStrategyVO, pageNum, pageSize);
	}

	@Override
	public List<ConditionVO> getPresetCondition() {
		return this.conditionDao.getPresetConditionList();
	}

	@Override
	public ConditionVO getConditionById(String conditionId) {
		return this.conditionDao.getConditionById(conditionId);
	}

	/**
	 *
	 * @Title: stopdistributeStrategy
	 * @Description: 将其他的分单策略改为停用
	 * @author 孟凡岭
	 * @param @param id
	 * @throws
	 */
	@Override
	public void stopdistributeStrategy(String id) {
		// TODO Auto-generated method stub
		this.distributeStrategyDao.stopdistributeStrategy(id);
	}

	/**
	 *
	 * @Title: stop
	 * @Description: 停用策略
	 * @author 孟凡岭
	 * @param @param idsList
	 * @throws
	 */
	@Override
	public void stop(List<String> idsList) {
		// TODO Auto-generated method stub
		this.distributeStrategyDao.stop(idsList);
	}

	/**
	 *
	 * @Title: open
	 * @Description: 启用策略，并将其他策略设为停用
	 * @author 孟凡岭
	 * @param @param id
	 * @throws
	 */
	@Override
	public void open(String id) {
		// TODO Auto-generated method stub
		this.distributeStrategyDao.open(id);
	}

	/**
	 *
	 * @Title: deleteDis
	 * @Description: 删除策略
	 * @author 孟凡岭
	 * @param @param idsList
	 * @throws
	 */
	@Override
	public void deleteDis(List<String> idsList) {
		// TODO Auto-generated method stub
		this.distributeStrategyDao.deleteDis(idsList);
	}
}
